home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / games / gnome-sudoku < prev    next >
Text File  |  2009-09-22  |  2KB  |  68 lines

  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # GNOME Sudoku is a simple sudoku generator and player. Sudoku is a 
  5. # japanese logic puzzle. This is the startup script which imports 
  6. # the relevant modules. Please keep the startup script in sync 
  7. # between glChess and gnome-sudoku.
  8. #
  9. # Copyright (c) 2005 Tom Hinkle You may use and distribute this
  10. # software under the terms of the GNU General Public License, version
  11. # 2 or later.
  12.  
  13. # Ignore any exceptions writing to stdout using print statements
  14. class SafeStdout:
  15.     def __init__(self):
  16.         self.stdout = sys.stdout
  17.     
  18.     def fileno(self):
  19.         return self.stdout.fileno()
  20.  
  21.     def write(self, data):
  22.         try:
  23.             self.stdout.write(data)
  24.         except:
  25.             pass
  26. import sys
  27. sys.stdout = SafeStdout()
  28.  
  29. # Setup bugbuddy to report unhandled exceptions.
  30. try: 
  31.   import bugbuddy
  32.   bugbuddy.install('gnome-sudoku')
  33. except:
  34.   #No bugbuddy support
  35.   pass 
  36.  
  37. import sys
  38.  
  39. try:
  40.     # Import gnome-sudoku module from source distribution.
  41.     import lib;
  42.     sys.modules["gnome_sudoku"] = sys.modules["lib"];
  43.     from gnome_sudoku.gnome_sudoku import start_game
  44.  
  45. except ImportError:
  46.     try:
  47.       # Import gnome-sudoku from pyexecdir or system installation.
  48.       from gnome_sudoku.gnome_sudoku import start_game
  49.  
  50.     except ImportError:
  51.       # Import of gnome-sudoku failed. Show error message.
  52.       import gtk
  53.       import os.path
  54.       import gettext
  55.       from gettext import gettext as _
  56.         
  57.       gettext.bindtextdomain('gnome-games', os.path.join('/usr', 'share', 'locale'))
  58.       gettext.textdomain('gnome-games')
  59.       title = _("Sudoku incorrectly installed")
  60.       description = _("""Sudoku is not able to start because required application files are not installed. If you are currently upgrading your system please wait until the upgrade has completed.""")
  61.       dialog = gtk.MessageDialog(type = gtk.MESSAGE_ERROR, message_format = title)
  62.       dialog.format_secondary_text(description)
  63.       dialog.add_button(gtk.STOCK_QUIT, gtk.RESPONSE_CLOSE)
  64.       dialog.run()
  65.       sys.exit(0)
  66.  
  67. start_game()
  68.